#!/bin/sh

set -eu

INSTALL_DIR="$JIAPKG_INSTALL_DIR"
JOBS="$JIAPKG_JOBS"
JIAPKG="$JIAPKG_EXE"

jiapkg_build() {
	autoreconf -i
	./configure --prefix="$INSTALL_DIR"/ \
		--with-oniguruma="$($JIAPKG info --install-dir oniguruma)"

	make -j"$JOBS"
}

jiapkg_install() {
	make install
}

case "$1" in
build) jiapkg_build ;;
install) jiapkg_install ;;
esac
